package com.example.tliaswebmanagement.exception;

//全局异常处理器


import com.example.tliaswebmanagement.pojo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    //Exception.class-->捕获所有异常
    @ExceptionHandler(Exception.class)

    public Result ex(Exception ex){
        ex.printStackTrace();
        //返回错误信息
        return Result.error("对不起，您的操作有误");
    }

}